/*     */ package com.lmpop.trade.ts_role;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ts_roleInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ts_roleInfo()
/*     */   {
/*  17 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  27 */     Ts_role ts_role = new Ts_role();
/*  28 */     ts_role.setRole_code(map.getString("role_code"));
/*  29 */     ts_role.setRole_name(map.getString("role_name"));
/*  30 */     ts_role.setCust_id(map.getString("session_cust_id"));
/*  31 */     ts_role.setRemark(map.getString("remark"));
/*  32 */     String flag = map.getString("flag");
/*     */ 
/*  34 */     String result_code = "0";
/*     */     try {
/*  36 */       if (flag.equals("0"))
/*  37 */         insert(dbmMgr, ts_role);
/*  38 */       else if (flag.equals("1"))
/*  39 */         update(dbmMgr, ts_role);
/*     */     }
/*     */     catch (ApplicationException e) {
/*  42 */       e.printStackTrace();
/*  43 */       result_code = "1";
/*     */     }
/*  45 */     map.setString("result_code", result_code);
/*  46 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ts_role ts_role)
/*     */     throws ApplicationException
/*     */   {
/*  56 */     dbmMgr.update("insertTs_role", ts_role);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  66 */     String pkid_string = map.getString("pkid");
/*  67 */     String result_code = "0";
/*     */     try {
/*  69 */       if (!pkid_string.equals("")) {
/*  70 */         String[] pkStr = pkid_string.split("\\|");
/*  71 */         for (int i = 0; i < pkStr.length; i++) {
/*  72 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  76 */       e.printStackTrace();
/*  77 */       result_code = "1";
/*     */     }
/*  79 */     map.setString("result_code", result_code);
/*  80 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  89 */     dbmMgr.update("deleteTs_role", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  98 */     Ts_role ts_role = new Ts_role();
/*  99 */     ts_role.setRole_code(map.getString("role_code"));
/* 100 */     ts_role.setRole_name(map.getString("role_name"));
/* 101 */     ts_role.setCust_id(map.getString("cust_id"));
/* 102 */     ts_role.setRemark(map.getString("remark"));
/*     */ 
/* 104 */     String result_code = "0";
/*     */     try {
/* 106 */       update(dbmMgr, ts_role);
/*     */     } catch (ApplicationException e) {
/* 108 */       e.printStackTrace();
/* 109 */       result_code = "1";
/*     */     }
/* 111 */     map.setString("result_code", result_code);
/* 112 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ts_role ts_role)
/*     */     throws ApplicationException
/*     */   {
/* 121 */     dbmMgr.update("updateTs_role", ts_role);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 132 */     Map params = (Hashtable)obj;
/* 133 */     if (start == 0)
/* 134 */       start = 0;
/*     */     else {
/* 136 */       start = (start - 1) * limit;
/*     */     }
/*     */ 
/* 139 */     params.put("start", Integer.valueOf(start));
/* 140 */     params.put("limit", Integer.valueOf(limit));
/*     */ 
/* 142 */     return this.queryList.getList("getTs_roleList", params);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 154 */     Map params = (Hashtable)obj;
/* 155 */     List list = this.queryList.getList("getTs_roleCount", params);
/* 156 */     int count = 0;
/* 157 */     if ((list != null) && (list.size() > 0)) {
/* 158 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 159 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 160 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 163 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 173 */     return this.queryList.getList("getTs_roleByPk", pk);
/*     */   }
/*     */ 
/*     */   public List getRoleInfoByCode(String cust_id, String role_code)
/*     */   {
/* 184 */     Ts_role ts_role = new Ts_role();
/* 185 */     ts_role.setCust_id(cust_id);
/* 186 */     ts_role.setRole_code(role_code);
/*     */ 
/* 188 */     return this.queryList.getList("getRoleInfo_Code", ts_role);
/*     */   }
/*     */ 
/*     */   public int ifSameRoleName(String role_name, String cust_id)
/*     */   {
/* 198 */     Ts_role ts_role = new Ts_role();
/* 199 */     ts_role.setCust_id(cust_id);
/* 200 */     ts_role.setRole_name(role_name);
/* 201 */     List rolelist = this.queryList.getList("ifSame_RoleName", ts_role);
/*     */ 
/* 203 */     if ((rolelist != null) && (rolelist.size() > 0)) {
/* 204 */       return 1;
/*     */     }
/* 206 */     return 0;
/*     */   }
/*     */ 
/*     */   public List getLeftMenuList(Object obj)
/*     */   {
/* 217 */     return this.queryList.getList("getLeft_MenuList", obj);
/*     */   }
/*     */ 
/*     */   public List getMenuInfoByUpMenuId(String up_menu_id)
/*     */   {
/* 226 */     return this.queryList.getList("getMenuInfo_UpMenuId", up_menu_id);
/*     */   }
/*     */ 
/*     */   public String getNameByRoleCode(String role_code)
/*     */   {
/* 235 */     List rolelist = this.queryList.getList("getName_RoleCode", role_code);
/* 236 */     String role_name = "";
/* 237 */     Hashtable roleMap = new Hashtable();
/* 238 */     if ((rolelist != null) && (rolelist.size() > 0)) {
/* 239 */       roleMap = (Hashtable)rolelist.get(0);
/* 240 */       if (roleMap.get("role_name") != null)
/* 241 */         role_name = roleMap.get("role_name").toString();
/*     */     }
/* 243 */     return role_name;
/*     */   }
/*     */ 
/*     */   public String getRoleBySelect(String cust_id)
/*     */   {
/* 254 */     List rolelist = this.queryList.getList("getTs_roleByPk", cust_id);
/* 255 */     String role_code = ""; String role_name = ""; String role_select = "";
/* 256 */     if ((rolelist != null) && (rolelist.size() > 0)) {
/* 257 */       for (int i = 0; i < rolelist.size(); i++) {
/* 258 */         Hashtable map = (Hashtable)rolelist.get(i);
/* 259 */         if (map.get("role_code") != null) {
/* 260 */           role_code = map.get("role_code").toString();
/*     */         }
/* 262 */         if (map.get("role_name") != null) {
/* 263 */           role_name = map.get("role_name").toString();
/*     */         }
/* 265 */         role_select = role_select + "<option value=" + role_code + ">" + role_name + "</option>";
/*     */       }
/*     */     }
/*     */ 
/* 269 */     return role_select;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ts_role.Ts_roleInfo
 * JD-Core Version:    0.6.0
 */